<?php
Yii::import('ext.redactor.ImperaviRedactorWidget');

/* @var $this ArticleController */
/* @var $model Article */
/* @var $form CActiveForm */
?>

<div class="form">
	
	<?php
	$properties = array(
		'id'=>'article-form',
		'enableAjaxValidation'=>false,
		'htmlOptions'=>array('enctype'=>'multipart/form-data'),
	);
	$form = $this->beginWidget('CActiveForm', $properties);
	$uploadUrl = $this->createUrl('uploadImage');
	?>

	<p class="note">
		Fields with <span class="required">*</span> are required.
	</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php
		echo $form->labelEx($model, 'preview');
		$properties = array(
			'model'=>$model,
			'attribute'=>'preview',
			'options'=>array(
				'css'=>'wym.css',
				'minHeight'=>200,
				'imageUpload'=>$uploadUrl,
			),
		);
		$this->widget('ImperaviRedactorWidget', $properties);
		echo $form->error($model, 'preview');
		?>
	</div>

	<div class="row">
		<?php
		echo $form->labelEx($model, 'value');
		$properties = array(
			'model'=>$model,
			'attribute'=>'value',
			'options'=>array(
				'css'=>'wym.css',
				'minHeight'=>200,
				'imageUpload'=>$uploadUrl,
			),
		);
		$this->widget('ImperaviRedactorWidget', $properties);
		echo $form->error($model, 'value');
		?>
	</div>

	<div class="row buttons">
		<?php
		$label = $model->isNewRecord ? 'Create' : 'Save';
		echo CHtml::submitButton($label);
		?>
	</div>
	
	<?php $this->endWidget(); ?>

</div><!-- form -->